<template>
  <header class="header">
    <h1>todos</h1>
    <input class="new-todo" placeholder="请输入任务名称" autofocus
    v-model.trim='cassName'
    @keyup.enter="addList"
     />
  </header>
</template>

<script>
export default {
  name: 'TodoHeader',
  props: {},
  data() {
    return {
      cassName: '',
    };
  },
  methods:{
    addList(){
        //要写东西 空不实现效果
        if(!this.cassName.length) return
        this.$emit('addList',this.cassName)
        this.cassName = ''
    }
  }
};
</script>

<style scoped lang="less"></style>
